home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / desaware / stgtools / reg_demo / findkey.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-27  |  3.9 KB  |  129 lines

  1. VERSION 4.00
  2. Begin VB.Form FindKey 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Find Key"
  5.    ClientHeight    =   2535
  6.    ClientLeft      =   1995
  7.    ClientTop       =   2805
  8.    ClientWidth     =   4995
  9.    ClipControls    =   0   'False
  10.    Height          =   3000
  11.    Left            =   1905
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   2535
  14.    ScaleWidth      =   4995
  15.    Top             =   2430
  16.    Width           =   5175
  17.    Begin VB.CommandButton ButtonCancel 
  18.       Cancel          =   -1  'True
  19.       Caption         =   "Close"
  20.       Height          =   375
  21.       Left            =   2280
  22.       TabIndex        =   8
  23.       Top             =   2040
  24.       Width           =   1215
  25.    End
  26.    Begin VB.CommandButton ButtonStart 
  27.       Caption         =   "Find"
  28.       Height          =   375
  29.       Left            =   3600
  30.       TabIndex        =   7
  31.       Top             =   2040
  32.       Width           =   1215
  33.    End
  34.    Begin VB.Frame Frame1 
  35.       Caption         =   "Search Area"
  36.       ClipControls    =   0   'False
  37.       Height          =   855
  38.       Left            =   120
  39.       TabIndex        =   4
  40.       Top             =   960
  41.       Width           =   4695
  42.       Begin VB.OptionButton OptCurrent 
  43.          Caption         =   "Start Search at Current Key"
  44.          Height          =   255
  45.          Left            =   2280
  46.          TabIndex        =   6
  47.          Top             =   360
  48.          Value           =   -1  'True
  49.          Width           =   2295
  50.       End
  51.       Begin VB.OptionButton OptRoot 
  52.          Caption         =   "Start Search at Root"
  53.          Height          =   255
  54.          Left            =   240
  55.          TabIndex        =   5
  56.          Top             =   360
  57.          Width           =   1935
  58.       End
  59.    End
  60.    Begin VB.CheckBox ChkWhole 
  61.       Caption         =   "Match Whole Key Only"
  62.       Height          =   375
  63.       Left            =   2640
  64.       TabIndex        =   3
  65.       Top             =   480
  66.       Width           =   2175
  67.    End
  68.    Begin VB.CheckBox ChkCase 
  69.       Caption         =   "Match Case"
  70.       Height          =   375
  71.       Left            =   480
  72.       TabIndex        =   2
  73.       Top             =   480
  74.       Width           =   1815
  75.    End
  76.    Begin VB.TextBox KeyText 
  77.       Height          =   285
  78.       Left            =   1440
  79.       TabIndex        =   0
  80.       Top             =   120
  81.       Width           =   3375
  82.    End
  83.    Begin VB.Label Label1 
  84.       BackStyle       =   0  'Transparent
  85.       Caption         =   "Key to Look For:"
  86.       Height          =   255
  87.       Left            =   120
  88.       TabIndex        =   1
  89.       Top             =   120
  90.       Width           =   1215
  91.    End
  92. Attribute VB_Name = "FindKey"
  93. Attribute VB_Creatable = False
  94. Attribute VB_Exposed = False
  95. Option Explicit
  96. ' Cancel Button.  Unloads the dialog box.
  97. Private Sub ButtonCancel_Click()
  98.     Unload FindKey
  99. End Sub
  100. ' Find Button.  Finds all the keys that match and
  101. ' puts them into another from.
  102. Private Sub ButtonStart_Click()
  103.     Dim sCase As Boolean
  104.     Dim whole As Boolean
  105.     Dim AtRoot As Boolean
  106.     Dim RetVal As Boolean
  107.     If Len(KeyText.Text) = 0 Then
  108.         MsgBox ("Cannot look for a null key")
  109.         Exit Sub
  110.     End If
  111.     sCase = (ChkCase.Value = 1)
  112.     whole = (ChkWhole.Value = 1)
  113.     AtRoot = OptRoot.Value
  114.     FindKey.MousePointer = 11
  115.     RetVal = BaseForm.Registry1.FindFirstKey(KeyText, sCase, whole, AtRoot)
  116.     If RetVal = False Then
  117.         MsgBox ("There are no keys in this root that match.")
  118.         FindKey.MousePointer = 0
  119.         Exit Sub
  120.     End If
  121.     FindKey.MousePointer = 0
  122.     FindResults.listresults.Clear
  123.     Do
  124.         FindResults.listresults.AddItem BaseForm.Registry1.FindResultKey
  125.     Loop While BaseForm.Registry1.FindNextKey() = True
  126.     FindResults.Show
  127.     Exit Sub
  128. End Sub
  129.